package com.kyrie;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @author wuxiang
 */
@SpringBootApplication
@ServletComponentScan
public class Application {
    static Logger logger = LoggerFactory.getLogger(Application.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(Application.class,args);

        ConfigurableEnvironment environment = context.getEnvironment();
        // 当前项目环境
        logger.info("项目当前运行环境: {}",environment.getProperty("spring.profiles.active"));
        String port = environment.getProperty("server.port");
        String contextPath = environment.getProperty("server.servlet.context-path");
        logger.info("##########项目启动完成，运行地址为: {} ##########","http://localhost:"+port+contextPath);
    }
}
